<template>
<div class="box">
    <van-cell value="该档案仅作为参考，以实际到院病历为准" />
    <div v-if="list.length !== 0">
        <div class="list" v-for="(item,index) in list" :key="index" style="margin-top:10px">
            <van-cell title="治疗时间：" :value="item.treat_date" size="mini" />
            <!-- <van-cell title="治疗项目：" :value="item.trinfo" size="mini" /> -->


            <div style="width:100%;display:flex;flex-direction:row;
            box-sizing:border-box;padding-right:15px;
            justify-content: space-between;padding-left:16px">
                <div style="color:#7e7e7e;font-size:14.5px;">治疗项目：</div>
                <div style="flex:1;text-align:left;color:#92202b">
                    <div style="margin-top:0px;font-size:14.5px;padding-left:8px;margin-bottom:1px" v-for="(items,indexs) in item.itemInfo" :key="indexs">{{items}}</div>
                </div>
            </div>
            <van-cell title="治疗地点：" value="广州曙光医学美容医院" size="mini" />

            <van-cell title="客管专员:" :value="item.consultant" size="mini" />

        </div>
    </div>

    <div v-if="list.length == 0" style="margin-top:10px">
        <van-cell value="暂无数据" />
    </div>

     <float-icons padding="10 0 60 0" class="icons-warp">
        <div class="float-icon-item">
            <img src="../../assets/dargIcon/back.png" alt="" @click="handleIcons('/home')" />
            <span>返回</span>
        </div>
        <!-- <div class="float-icon-item">
            <img src="../../assets/dargIcon/cart-icon.png" alt="" @click="handleIcons('/cart')" />
            <span>购物车</span>
        </div> -->
    </float-icons>


</div>
</template>

<script>
import FloatIcons from '@/components/s-icons'
import {
    toast
} from "../../utils/toast.js"
import {
    getArchives
} from "../../sgApi/index.js"
import { isbind } from '../isCheckBind.js'
export default {
    name: "archives",
    components:{
        FloatIcons
    },
    data() {
        return {
            list: [

                // {
                //     treat_date: "2020-12-05",
                //     doctor_name: "doctor_name",
                //     trinfo: "1、无创中心—无创其他、无创中心—无创其他（1次）[邹素欣]/n1、无创中心—无创其他（1次）[邹素欣]\n2、无创中心—无创其他（1次）[邹素欣]\n",
                //     consultant: "123",
                //     itemInfo:[
                //         "123","456"
                //     ]

                // }

            ]
        }
    },
    mounted() {
        isbind()
        this.init()
    },
    methods: {
        init() {
            // console.log(localStorage.getItem("customerCrmId"))
            let customerCrmId = localStorage.getItem("customerCrmId")

            // let customerCrmId="SGC00480406"
            getArchives({
                customerCrmId
            }).then(res => {
                console.log("achRes", res)
                if (res.code == 0) {
                    // this.list = res.data

                    if (res.data.length == 0) {
                        toast({
                            message: "暂无数据!",
                            time: 2000
                        })
                    } else {
                        let list = res.data
                        list.forEach(item=>{
                            let arr = item.trinfo.split("<br>")
                            item.itemInfo=arr
                        })
                        this.list = list

                        
                    }

                } else {

                    toast({
                        message: "网络错误",
                        time: "2000"
                    })

                }
            })
        },
          handleIcons(id) {
            // this.$router.go(-1)
            this.$router.replace({
                path:"/memberCenter"
            })
        },
    }

}
</script>

<style lang="scss" scoped>
.box {
    padding-top: 12px;
    padding-bottom: 12px;
    width: 100%;
    

    .list {
        background-color: #ffffff;
        padding-top: 8px;
        padding-bottom: 8px;

        .van-cell::after {
            border-bottom: none
        }

        .money {
            .van-cell__value {
                font-size: 16px;
            }

        }

        .van-cell {
            padding-top: 2px;
            padding-bottom: 2px;
            justify-content: left;

            .van-cell__title {
                color: #7e7e7e;

                // width: 100px;
            }

            .van-cell__value {
                flex: 3.6;
                color: #92202b;
                text-align: left;
            }

        }
    }

     .icons-warp {
        border-radius: 25px 0 0 25px;

        .float-icon-item {
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: center;
            position: relative;
            width: 80px;
            height: 40px;

            img {
                width: 25px;
                height: 25px;
                margin-bottom: 3px;
            }

            span {
                 margin-left: 5px;
                font-size: 12px;
                color: #666666;
            }
        }
    }
}
</style>
